import java.util.Scanner;
import java.util.StringTokenizer;

public class LCMGCDExample {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 获取用户输入
        String input = scanner.nextLine();

        // 使用StringTokenizer解析输入
        StringTokenizer tokenizer = new StringTokenizer(input, ",");
        int[] numbers = new int[tokenizer.countTokens()];

        for (int i = 0; tokenizer.hasMoreTokens(); i++) {
            numbers[i] = Integer.parseInt(tokenizer.nextToken().trim());
        }

        int max = gcd(numbers[0], numbers[1]);
        int min = lcm(numbers[0], numbers[1]);
        System.out.println("最大公约数和最小公倍数为(" + max + "," + min + ")");

        scanner.close();
    }
    public static int gcd(int a, int b) {
        while (b != 0) {
            int temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }
    public static int lcm(int a, int b) {
        return a / gcd(a, b) * b;
    }
}